<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js</title>
</head>
<body>
	<h1>00001</h1>
	<h1>00002</h1>
	<h1>00003</h1>
	<h1>00004</h1>
	<h1>00005</h1>
	

</body>

<script>
	objs=document.getElementsByTagName('h1');
	for(i=0; i<objs.length;i++){
		
		objs[i].onclick=function(){

			this.style.background='#ccc';
			
		}

		objs[i].onmouseleave=function(){
			this.style.background='#fff';
			
		}
	}

</script>
</html>